<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div id="root">hi</div>
    <input type="button" value="on event" onclick="eon()">
    <input type="button" value="off event" onclick="eoff()">
    <input type="button" value="trigger event" onclick="etrigger()">
    <script src="index.js"></script>
    <script>
        var root = document.getElementById("root");
        function eon() {
            on(root,"build",e=>{
                root.innerText=e.type+Math.random();
            });
        }
        function eoff() {
            off(root,"build");
        }
        function etrigger() {
            trigger(root,"build");
        }
    </script>
</body>
</html>